package com.heima.admin.controller;

import com.heima.api.INewsClient;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmSensitiveDto;
import com.heima.model.wemedia.dtos.WmSensitiveListDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 敏感词
 */
@RestController
@RequestMapping("/api/v1/sensitive")
@Slf4j
public class SensitiveWordsController {
    @Autowired
    private INewsClient iNewsClient;

    /**
     * 删除敏感词
     *
     * @param id
     * @return
     */
    @DeleteMapping("/del/{id}")
    public ResponseResult deleteSensitiveById(@PathVariable Integer id) {
        return iNewsClient.deleteSensitiveById(id);
    }

    /**
     * 敏感词分页查询
     *
     * @param dto
     * @return
     */
    @PostMapping("/list")
    public PageResponseResult listSensitive(@RequestBody WmSensitiveListDto dto) {
        return iNewsClient.listSensitive(dto);
    }

    /**
     * 添加敏感词
     *
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveSensitive(@RequestBody WmSensitiveDto dto) {
        return iNewsClient.saveSensitive(dto);
    }

    /**
     * 修改敏感词
     * @param dto
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateSensitive(@RequestBody WmSensitiveDto dto) {
        return iNewsClient.updateSensitive(dto);
    }
}
